package com.fr.report.cellElement;

import com.fr.base.XMLable;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.report.core.barcode.BarCodeUtils;

public class BarcodeAttr
  implements XMLable
{
  public static final int CODE39 = 0;
  public static final int CODE39CHECK = 1;
  public static final int CODABAR = 2;
  public static final int CODE128 = 3;
  public static final int CODE128A = 4;
  public static final int CODE128B = 5;
  public static final int CODE128C = 6;
  public static final int EAN128 = 7;
  public static final int USPS = 8;
  public static final int SHIPMENT_ID = 9;
  public static final int SSCC_18 = 10;
  public static final int SCC_14 = 11;
  public static final int GTIN = 12;
  public static final int PDF417 = 13;
  public static final int USD_4 = 14;
  public static final int NW_7 = 15;
  private int type;
  private int barWidth;
  private int barHeight;
  private boolean drawingText;

  public BarcodeAttr()
  {
    this(0);
  }

  public BarcodeAttr(int paramInt)
  {
    this.barWidth = 1;
    this.barHeight = 12;
    this.drawingText = true;
    this.type = paramInt;
  }

  public int getType()
  {
    return this.type;
  }

  public void setType(int paramInt)
  {
    this.type = paramInt;
  }

  public int getBarWidth()
  {
    return this.barWidth;
  }

  public void setBarWidth(int paramInt)
  {
    this.barWidth = paramInt;
  }

  public int getBarHeight()
  {
    return this.barHeight;
  }

  public void setBarHeight(int paramInt)
  {
    this.barHeight = paramInt;
  }

  public boolean isDrawingText()
  {
    return this.drawingText;
  }

  public void setDrawingText(boolean paramBoolean)
  {
    this.drawingText = paramBoolean;
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if (paramXMLableReader.isAttr())
    {
      String str;
      if ((str = paramXMLableReader.getAttr("type")) != null)
        this.type = Integer.parseInt(str);
      if ((str = paramXMLableReader.getAttr("width")) != null)
        this.barWidth = Integer.parseInt(str);
      if ((str = paramXMLableReader.getAttr("height")) != null)
        this.barHeight = Integer.parseInt(str);
      if ((str = paramXMLableReader.getAttr("draw")) != null)
        this.drawingText = Boolean.valueOf(str).booleanValue();
    }
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    paramXMLPrintWriter.startTAG("BarcodeAttr");
    if (this.type != 0)
      paramXMLPrintWriter.attr("type", this.type);
    if (this.barWidth != 1)
      paramXMLPrintWriter.attr("width", this.barWidth);
    if (this.barHeight != 12)
      paramXMLPrintWriter.attr("height", this.barHeight);
    if (!(this.drawingText))
      paramXMLPrintWriter.attr("draw", this.drawingText);
    paramXMLPrintWriter.end();
  }

  public String toString()
  {
    return BarCodeUtils.getBarCodeTypeName(this.type);
  }

  public boolean equals(Object paramObject)
  {
    return ((paramObject instanceof BarcodeAttr) && (this.type == ((BarcodeAttr)paramObject).type) && (this.barHeight == ((BarcodeAttr)paramObject).barHeight) && (this.barWidth == ((BarcodeAttr)paramObject).barWidth) && (this.drawingText == ((BarcodeAttr)paramObject).drawingText));
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }
}